package com.project.service;

import java.io.Serializable;
import java.util.List;

/**
 * Generic Service Interface: Define generic method to process business.
 * 
 * @author travisl@synnex.com
 * 
 * @param <E>
 *            Entity
 * @param <P>
 *            Primary Key
 */

public interface GenericService<E extends Serializable, P extends Serializable> {
	/**
	 * generic method to save the entity instance.
	 * 
	 * @param entity
	 */
	public void save(E entity);

	/**
	 * generic method to save or update the entity instance.
	 * 
	 * @param entity
	 */
	public void saveOrUpdate(E entity);

	/**
	 * generic method to update the entity instance.
	 * 
	 * @param entity
	 */
	public void update(E entity);

	/**
	 * generic method to delete entity.
	 * 
	 * @param entity
	 */
	public void delete(E entity);

	/**
	 * generic method to get a entity by id.
	 * 
	 * @param id
	 * @return
	 */
	public E get(P id);

	/**
	 * generic method to get a all entity list.
	 * 
	 * @return
	 */
	public List<E> listAll();

}
